package alvarodelrosal.chat.client.chataction.local;

import alvarodelrosal.chat.client.chataction.infraestructuraremota.AllChats;
import java.util.List;

public class ChatConversation implements ChatLocalAction {

    @Override
    public String getName() {
        return "Conversation";
    }

    @Override
    public void doAction(List<String> parameters) {
        int id = Integer.parseInt(parameters.get(0));
        for (int possition = 1; possition < parameters.size(); possition += 2) {
            int userId = Integer.parseInt(parameters.get(possition));
            String text = parameters.get(possition + 1);
            AllChats.addMessage(id, userId, text);
        }
    }
}
